package com.ctg.payroll2.service.social.impl;

import java.util.List;

import com.ctg.payroll2.bean.filter.social.CsEmpsocialResultFilter;
import com.ctg.payroll2.bean.po.social.CsEmpsocialResult;
import com.ctg.payroll2.bean.po.social.CsEmpsocialTotal;
import com.ctg.payroll2.service.BaseService;
import com.ctg.payroll2.service.social.CsEmpsocialResultService;
import com.ctg.platform.orm.ibatis.IbatisEntityDao;
import com.ctg.platform.util.Page;

public class CsEmpsocialResultServiceImpl extends BaseService implements
		CsEmpsocialResultService {
	@SuppressWarnings("unchecked")
	private IbatisEntityDao ibatisEntityDao;
	/**
	 * @param ibatisEntityDao 设置ibatisEntityDao
	 */
	@SuppressWarnings("unchecked")
	public void setIbatisEntityDao(IbatisEntityDao ibatisEntityDao) {
		this.ibatisEntityDao = ibatisEntityDao;
	}
	public Page queryCsEmpsocialResult(CsEmpsocialResultFilter filter) {
		return ibatisEntityDao.pagedQueryByFilter(this.getClass(), filter,
				".queryCsEmpsocialResult_count",
				".queryCsEmpsocialResult_query");
	}

	public Page queryCsEmpResult(CsEmpsocialResultFilter filter) {
		return ibatisEntityDao.pagedQueryByFilter(this.getClass(), filter,
				".queryCsEmpResult_count",
				".queryCsEmpResult_query");
	}

	@SuppressWarnings("unchecked")
	public List<CsEmpsocialResult> queryCsEmpsocialList(CsEmpsocialResultFilter fielter) {
		return ibatisEntityDao.getSqlMapClientTemplate().queryForList(getNameSpace() 
				+ ".queryCsEmpsocialList_query", fielter);
	}
	
	@SuppressWarnings("unchecked")
	public CsEmpsocialTotal queryCsEmpsocialTotal(CsEmpsocialResultFilter filter) {
		Page page = queryCsEmpResult(filter);
		CsEmpsocialTotal empSocialTotal = null;
		if(page.getTotalCount() > 0){
			List list = (List)page.getResult();
			empSocialTotal = (CsEmpsocialTotal)list.get(0);
		}
		return empSocialTotal;
	}

}
